import axios from '@/libs/api.request'
import config from '@/config'
import store from '@/store'

const headers = {
  'Content-Type': 'application/json; charset=utf-8'
}

const defaults = () => ({
  AUserName: store.state.user.userName,
  Atoken: store.state.user.token,
  IfUrlCode: 0
})

export const login = ({ userName, password }) => {
  const data = {
    AUserName: userName,
    APwd: password,
    IfUrlCode: 0
  }

  return axios.request({
    url: config.api.login,
    method: 'post',
    headers,
    data
  })
}

export const logout = ({ userName, token }) => {
  const data = {
    AUserName: userName,
    Atoken: token,
    IfUrlCode: 0
  }
  return axios.request({
    url: config.api.logout,
    method: 'post',
    headers,
    data
  })
}

export const usermodifypwd = async data => {
  try {
    const res = await axios.request({
      url: config.api.usermodifypwd,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const getMenuManageListInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.menugetlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), data || {})
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const deleteMenu = async data => {
  try {
    const res = await axios.request({
      url: config.api.menudelete,
      method: 'post',
      headers,
      // data: _.assign({}, defaults(), { data: { name: data.name } })
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const addMenu = async data => {
  try {
    const res = await axios.request({
      url: config.api.menuAdd,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const updateMenu = async data => {
  try {
    const res = await axios.request({
      url: config.api.menuupdate,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const getMenuInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.menugetinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取用户角色列表
export const getUserRoleList = async data => {
  try {
    const res = await axios.request({
      url: config.api.rolegetlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加角色
export const addUserRole = async data => {
  try {
    const res = await axios.request({
      url: config.api.roleAdd,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新角色
export const updateUserRole = async data => {
  try {
    const res = await axios.request({
      url: config.api.roleupdate,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取用户角色信息通过角色名称
export const getRoleInfoByName = async data => {
  try {
    const res = await axios.request({
      url: config.api.rolegetinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除角色
export const deleteRole = async data => {
  try {
    const res = await axios.request({
      url: config.api.roledelete,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取超级管理员默认角色列表
export const getAdminRoleList = async data => {
  try {
    const res = await axios.request({
      url: config.api.defaultrolegetlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新超级管理员默认角色列表
export const updateAdminRoleList = async data => {
  try {
    const res = await axios.request({
      url: config.api.defaultroleupdate,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加超级管理员默认角色列表
export const addAdminRoleList = async data => {
  try {
    const res = await axios.request({
      url: config.api.defaultroleAdd,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), data || {})
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取运营商信息
export const getAgentTableData = async data => {
  try {
    const res = await axios.request({
      url: config.api.getOperatorlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), data || {})
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 增加运营商
export const addAgent = async data => {
  try {
    const res = await axios.request({
      url: config.api.AddOperator,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const setFormData = data => {
  return axios.request({
    url: 'set_form_data',
    method: 'post',
    data
  })
}

// 修改运营商
export const updateAgent = async data => {
  try {
    const res = await axios.request({
      url: config.api.updateOperator,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除运营商
export const deleteAgent = async data => {
  try {
    const res = await axios.request({
      url: config.api.deleteOperator,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加用户
export const addUser = async data => {
  try {
    const res = await axios.request({
      url: config.api.useradd,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新用户
export const updateUser = async data => {
  try {
    const res = await axios.request({
      url: config.api.userupdate,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取网站用户列表
export const getUserList = async data => {
  try {
    const res = await axios.request({
      url: config.api.usergetlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取指定的充电站信息
export const getStationInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getStationInfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除充电站
export const deleteStation = async data => {
  try {
    const res = await axios.request({
      url: config.api.deletestation,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取默认运营商角色菜单列表
export const getDefaultRoleMenuList = async data => {
  try {
    const res = await axios.request({
      url: config.api.defaultrolegetinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 运营商获取充电站列表信息
export const getStationList = async data => {
  try {
    const res = await axios.request({
      url: config.api.getStationlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加充电站
export const addStation = async data => {
  try {
    const res = await axios.request({
      url: config.api.AddStation,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新充电站
export const updateStation = async data => {
  try {
    const res = await axios.request({
      url: config.api.updatestation,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取指定运营商信息
export const getOperatorInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getOperatorInfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取统计数据--按年
export const getStatsByYear = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_operator_years,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取统计数据--按月
export const getStatsByMonth = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_operator_months,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取统计数据--按日
export const getStatsByDay = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_operator_months_days,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取统计数据--按手机端(按站)
export const getStatsByPhoneStation = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_operator_app_amount,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 取充电桩列表
export const getEquipmentlist = async data => {
  try {
    const res = await axios.request({
      url: config.api.getequipmentlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加充电桩列表
export const addEquipment = async data => {
  try {
    const res = await axios.request({
      url: config.api.Addequipment,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 修改充电桩列表
export const updateEquipment = async data => {
  try {
    const res = await axios.request({
      url: config.api.updateequipment,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除充电桩
export const deleteEquipment = async data => {
  try {
    const res = await axios.request({
      url: config.api.deleteequipment,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 取指定充电桩列表
export const getEquipmentInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getequipmentinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 查询充电桩信息
export const queryPileStatusList = async data => {
  try {
    const res = await axios.request({
      url: config.api.querypilestatuslist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电过程记录
export const queryChargeRecord = async data => {
  try {
    const res = await axios.request({
      url: config.api.getchargerecord,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电过程查询
export const queryChargeProcess = async data => {
  try {
    const res = await axios.request({
      url: config.api.getchargeprocedurelist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 客户列表查询
export const getCustomerList = async data => {
  try {
    const res = await axios.request({
      url: config.api.getcustomerlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 取指定客户信息
export const getCustomerInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getcustomerinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加客户
export const addCustomer = async data => {
  try {
    const res = await axios.request({
      url: config.api.Addcustomer,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新客户
export const updateCustomer = async data => {
  try {
    const res = await axios.request({
      url: config.api.updatecustomer,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除客户
export const deleteCustomer = async data => {
  try {
    const res = await axios.request({
      url: config.api.deletecustomer,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取客户IC卡列表信息
export const getCustomerCardIdList = async data => {
  try {
    const res = await axios.request({
      url: config.api.getcustomercardidlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 获取指定客户IC卡信息
export const getCustomerCardIdInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getcustomercardidinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除客户IC卡
export const deleteCustomerCardId = async data => {
  try {
    const res = await axios.request({
      url: config.api.deletecustomercardid,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新客户IC卡
export const updateCustomerCardId = async data => {
  try {
    const res = await axios.request({
      url: config.api.updatecustomercardid,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加客户IC卡
export const addCustomerCardId = async data => {
  try {
    const res = await axios.request({
      url: config.api.Addcustomercardid,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 卡充值
export const rechargeCardId = async data => {
  try {
    const res = await axios.request({
      url: config.api.rechargecardid,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 卡充值记录
export const getRechargeByCardId = async data => {
  try {
    const res = await axios.request({
      url: config.api.getrechargebycardid,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 遥控
export const createEquipmentCommandYK = async data => {
  try {
    const res = await axios.request({
      url: config.api.createequipmentCommand_YK,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 遥控召回充电记录
export const createEquipmentCommandYKResetBill = async data => {
  try {
    const res = await axios.request({
      url: config.api.createequipmentCommand_YKResetbill,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站大屏
export const bigscreen = async data => {
  try {
    const res = await axios.request({
      url: config.api.BigscreenOfStation,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 运营商大屏
export const bigscreenOperation = async data => {
  try {
    const res = await axios.request({
      url: config.api.bigscreenofoperator,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 管理员大屏
export const bigscreenAdmin = async data => {
  try {
    const res = await axios.request({
      url: config.api.bigscreenofadmin,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}


// 获取充电站电价信息
export const getStationPriceInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getstationpriceinfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 更新充电站电价
export const updateStationPrice = async data => {
  try {
    const res = await axios.request({
      url: config.api.updatestationprice,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 添加充电站电价
export const addStationPrice = async data => {
  try {
    const res = await axios.request({
      url: config.api.Addstationprice,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 删除充电站电价
export const deleteStationPrice = async data => {
  try {
    const res = await axios.request({
      url: config.api.deletestationprice,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按年
export const getStationStatsByYear = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_years,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按月
export const getStationStatsByMonth = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_months,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按日
export const getStationStatsByDay = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_months_days,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按IC卡+按年
export const getStationStatsByICYear = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_cardid_years,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按IC卡+按月
export const getStationStatsByICMonth = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_cardid_months,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 按IC卡+按日
export const getStationStatsByICDay = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_cardid_months_days,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站统计 -- 手机端
export const getStationStatsByApp = async data => {
  try {
    const res = await axios.request({
      url: config.api.Statistics_station_app_amount,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 车牌号查列表
export const getStationCarnumList = async data => {
  try {
    const res = await axios.request({
      url: config.api.getstation_carnumlist,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 删除车牌号
export const deleteStationCarnum = async data => {
  try {
    const res = await axios.request({
      url: config.api.deletestation_carnum,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 查询指定车牌号
export const getStationCarnumInfo = async data => {
  try {
    const res = await axios.request({
      url: config.api.getstation_carnuminfo,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 更新指定车牌号
export const updateStationCarnum = async data => {
  try {
    const res = await axios.request({
      url: config.api.updatestation_carnum,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 添加车牌号
export const addStationCarnum = async data => {
  try {
    const res = await axios.request({
      url: config.api.Addstation_carnum,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 充电站 -- 充电桩电价命令
export const sysStationPrice = async data => {
  try {
    const res = await axios.request({
      url: config.api.createstationpriceCommand,
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

// 读卡
export const readCardNumber = async data => {
  try {
    const res = await axios.request({
      baseURL: 'http://127.0.0.1:11111',
      url: '/getcardid',
      method: 'post',
      headers,
      data: _.assign({}, defaults(), { data })
    })
    return res
  } catch (e) {
    return {
      code: 5001,
      desc: e.message
    }
  }
}

export const getAgentChargeStationData = data => {
  return axios.request({
    url: 'get_agent_charge_station_data',
    method: 'post',
    data
  })
}

export const getAgentSelectStationTimeCostData = data => {
  return axios.request({
    url: 'get_agent_select_station_time_cost_data',
    method: 'post',
    data
  })
}

export const getAgentPileData = data => {
  return axios.request({
    url: 'get_agent_pile_data',
    method: 'post',
    data
  })
}

export const getCustomInfoData = data => {
  return axios.request({
    url: 'get_custom_info_data',
    method: 'post',
    data
  })
}

export const getAppUserManageInfo = data => {
  return axios.request({
    url: 'get_appuser_manage_info',
    method: 'post',
    data
  })
}

export const getAppSuggestFeedbackInfo = data => {
  return axios.request({
    url: 'get_app_suggest_feedback_info',
    method: 'post',
    data
  })
}

export const getLoginUserInfo = data => {
  return axios.request({
    url: 'get_login_user_info',
    method: 'post',
    data
  })
}

export const getUserLoginLogInfo = data => {
  return axios.request({
    url: 'get_user_login_log_info',
    method: 'post',
    data
  })
}

export const getSystemMsgInfo = data => {
  return axios.request({
    url: 'get_system_msg_info',
    method: 'post',
    data
  })
}
